package cn.stylefeng.guns.modular.api;

import cn.stylefeng.guns.modular.business.service.UserAccountService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author pzp .
 * @Date 2019/8/421:40
 */
@RestController
@RequestMapping("/gunsApi/userAccount")
public class UserAccountApi extends BaseController{

    @Autowired
    private UserAccountService userAccountService;

    @ApiOperation("添加账号")
    @PostMapping("/addOrUpdate")
    public ResponseData addOrUpdate(Integer id,@RequestParam String realName,@RequestParam Long userId,@RequestParam Integer payMode,@RequestParam String account,String bank) {
        userAccountService.addOrUpdate(id,realName,userId, payMode, account, bank);
        return ResponseData.success();
    }

    @ApiOperation("删除账号")
    @GetMapping("/delete")
    public ResponseData delete(@RequestParam Integer id) {
        userAccountService.delete(id);
        return ResponseData.success();
    }


    @ApiOperation("账号列表")
    @GetMapping("/list")
    public ResponseData list(@RequestParam  Long userId,@RequestParam Integer payMode) {
        return ResponseData.success(userAccountService.list(userId,payMode));
    }


}
